home *** CD-ROM | disk | FTP | other *** search
- '********************************************************************
- '
- ' This script calls MSI HQ BBS and uploads and downloads mail using
- ' the Tomcat mail door online.
- '
- '********************************************************************
-
- ' Declare the DialModem subroutine (it appears later in the file)
-
- declare sub DialModem
-
- ' Dial the modem and wait for a connect. Normally we wouldn't do this
- ' because this script would be run from a dialing directory entry and
- ' we would already be connected.
-
- call DialModem
-
- ' Set up a when on "-Pause-" to take care of the case where the sysop has
- ' a prelog screen with a pause in it.
-
- when match "-Pause-" do send
-
- ' Wait for name and password prompts and send the correct responses.
-
- waitfor "first name"
- send "greg hewgill"
- waitfor "password"
- send "password"
-
- ' Set up a number of match type whens to provide answers to various prompts
- ' and so on.
-
- when match "] to continue" do send
- when match "view the bulletin menu" do send "N"
- when match "have new personal mail" do send "C"
- when match "protocol menu [" do send "Z"
-
- ' A when quiet is used to press Enter whenever we don't get any characters
- ' for a particular amount of time (10 seconds in this case)
-
- when quiet 10 do send
-
- ' Set the default timeout to 60 seconds - if we don't get what we're looking
- ' for then just abort (below in the "catch err_timeout" section)
-
- timeout 60
-
- ' Make our way to the Tomcat main menu
-
- waitfor "command"
- send "M"
- waitfor "command"
- send "T"
- waitfor "tomcat menu ["
-
- ' Now we're at the Tomcat main menu. Check to see if we have a REP file
- ' to upload. If so, go ahead and send it up.
-
- if exists("c:\dl\mustang.rep") then
- send "U"
- waitfor "now"
- if upload("c:\dl\mustang.rep", Zmodem) = 0 then
- del "c:\dl\mustang.rep"
- end if
- waitfor "tomcat menu ["
- end if
-
- ' Now download the new mail. We will provide a timeout of 200 seconds
- ' on the 'waitfor' that waits for the prompt at the end of the scan,
- ' that way if this takes a long time we won't just abort.
-
- send "D"
- waitfor "would you like", 200
-
- ' Respond to the download prompt and download the file
-
- send "Y"
- waitfor "now", 120
- del "c:\dl\mustang.qwk"
- call download("c:\dl", Zmodem)
-
- ' Wait for Tomcat to return to its menu and send the command to log off.
-
- waitfor "tomcat menu ["
- send "G"
-
- ' At this point the script will end and return to terminal mode.
-
- end
-
- ' This is a catch clause for the main program body, it handles timeout
- ' errors that are not otherwise handled. If we get a timeout here, then
- ' there's not much we can do so we just hang up and abort.
-
- catch err_timeout
- hangup
- end
-
- '*****
- '
- ' This is a subroutine to dial a modem and wait for a connect. Normally
- ' this would be handled with the dialing directory automatically (and this
- ' script would only be called after a connect).
- '
- '*****
-
- sub DialModem
- dim s as string
- timeout 30
- do
- tryagain:
- send "ATDT0250"
- do
- receive s
- if left(s, 7) = "CONNECT" then
- exit sub
- end if
- if s = "NO CARRIER" or s = "BUSY" then
- exit do
- end if
- loop
- delay 1
- loop
- catch err_timeout
- send
- print "timeout happened"
- delay 1
- goto tryagain
- end sub
-